<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
		<title>代码自动生成</title>
		<script type="text/javascript" src="../../commonFragment/header.js"></script>
		<script type="text/javascript" src="../../commonFragment/nojs.header.js"></script>
	</head>
	<body>
		<div class="container-fluid p-t-15">
			<div class="row">
				<div class="col-lg-12">
					<div class="card">
						<div class="card-header">
							<h4>bootstrap-table简单示例</h4>
						</div>
						<div class="card-body">
							<form id="toolbar" class="form-inline pull-right">
								<!-- 查询条件 -->
								<div class="form-group">
									<label class="sr-only" for="lookup-username">表名</label>
									<input type="text" class="form-control input-sm" id="lookup-name" name="tableName" placeholder="请输入表名"
									 autocomplete="off" />
								</div>
								<div class="form-group">
									<label class="sr-only" for="lookup-username">备注</label>
									<input type="text" class="form-control input-sm" id="lookup-comments" name="comments" value="" placeholder="请输入表的备注"
									 autocomplete="off" />
								</div>

								<div class="form-group">
									<label class="sr-only" for="lookup-opened">引擎</label>
									<select class="form-control input-sm" id="lookup-opened" name="engine" data-value="">
										<option value="">--请选择--</option>
										<option value="InnoDB">InnoDB</option>
										<option value="MyISAM">MyISAM</option>
									</select>
								</div>

								<div class="form-group form-btn-bar">
									<button type="button" class="btn btn-primary btn-sm query">
										<i class="glyphicon glyphicon-search"></i> 查询
									</button>
									<button type="button" class="btn btn-info btn-sm reset">
										<i class="glyphicon glyphicon-refresh"></i> 重置
									</button>

								</div>
							</form>
							<table id="generatorTable" class="table table-bordered table-hover table-striped bootstrapTable" data-list-url="/generator/list"
							data-form-url="module/develop/lcxm_other_generator_form.html"
							 data-toolbar="#toolbar">
								<thead>
									<tr>
										<th data-checkbox="true"></th>
										<th data-field="tableName" data-click-to-select="true">表名称</th>
										<th data-field="comments">表备注</th>
										<th data-field="createTime" data-sortable="true" data-halign="center">创建时间</th>
										<th data-field="engine" data-align="center">表引擎</th>
										<th data-field="operate" data-formatter="operate" data-events="operateEvent">操作</th>
									</tr>
								</thead>

							</table>
						</div>

					</div>
				</div>
			</div>
		</div>
		<!-- 点击下载弹出的输出框 -->
		<div class="hide" id="download">
			<form class="form-horizontal" role="form" method="post">
				<input type="hidden" name="tableNames" />
				<div class="form-group">
					<label for="parentId" class="col-sm-2 control-label">主包</label>
					<div class="col-sm-10 ">
						<input type="text" class="form-control" id="packageName" value="pers.vic.boot.console" name="packageName"
						 autocomplete="off" />
					</div>
				</div>
				<div class="form-group">
					<label for="parentId" class="col-sm-2 control-label">模块</label>
					<div class="col-sm-10 ">
						<input type="text" class="form-control" id="moduleName" value="system" name="moduleName" autocomplete="off" />
					</div>
				</div>
			</form>
		</div>
		<script>
			function operate(value, row, index, field) {
				let html =
				'<a href="#!" data-id="' + row.tableName +
				'" class="btn btn-xs btn-default edit-btn add-multitab in-table" data-title="生成代码配置" title="生成代码编辑页面" data-toggle="tooltip"><i class="mdi mdi-tooltip-edit"></i></a>'
					/* +'<a href="#!" class="btn btn-xs btn-default download-btn" title="下载" data-toggle="tooltip"><i class="fa fa-download"></i></a>' */;
				return html;
			}
			var operateEvent = {
				'click .download-btn': function(event, value, row, index) {
					common.confirm($("#download").html(), function() {
						$form = $("form", this.$content);
						var url = base_url + '/generator/export';
						$("[name='tableNames']").val(row.tableName);
						$form.attr("action", url)
						$form.submit();
						$("#download form")[0].reset();
					}, {
						columnClass:'col-md-6 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1'
					});
				}
			};
		</script>
	</body>

</html>
